import { createSSRApp } from 'vue'
import App from './App.vue'
import store from './store'
import api from './request/api'

// 组件
import mesSearch from './components/mes/mes-search.vue'
import mesForm from './components/mes/mes-form.vue'
import mesFormItem from './components/mes/mes-form-item.vue'
import mesCardIndex from './components/mes/mes-card-index.vue'
import mesButton from './components/mes/mes-button.vue'
import mesGoods from './components/mes/mes-goods.vue'
import mesChooseGoods from './components/mes/mes-choose-goods.vue'
import mesCardCheck from './components/mes/mes-card-check.vue'
import mesCardRadio from './components/mes/mes-card-radio.vue'
import mesTip from './components/mes/mes-tip.vue'
import mesPopup from './components/mes/mes-popup.vue'
import mesNavIndex from './components/mes/mes-nav-index.vue'
import mesCollapse from './components/mes/mes-collapse.vue'
import mesSerialBatch from './components/mes/mes-serial-batch.vue'

// 过滤器
import filters from './filters'

// 工具
import tools from './utils/tools'
import digit from './utils/digit'
//正式环境去除console.log
if (uni.getSystemInfoSync().platform !== "devtools") {
  console.log = () => { }
}
export function createApp() {
  const app = createSSRApp(App)
  // 接口
  app.config.globalProperties.$api = api

  // 过滤器(Vue3 已移除)
  app.config.globalProperties.$filters = filters

  // 工具
  app.config.globalProperties.$tools = tools
  app.config.globalProperties.$digit = digit

  // 组件
  app.component('mesSearch', mesSearch)
  app.component('mesForm', mesForm)
  app.component('mesFormItem', mesFormItem)
  app.component('mesCardIndex', mesCardIndex)
  app.component('mesNavIndex', mesNavIndex)
  app.component('mesButton', mesButton)
  app.component('mesGoods', mesGoods)
  app.component('mesChooseGoods', mesChooseGoods)
  app.component('mesCardCheck', mesCardCheck)
  app.component('mesCardRadio', mesCardRadio)
  app.component('mesTip', mesTip)
  app.component('mesPopup', mesPopup)
  app.component('mesCollapse', mesCollapse)
  app.component('mesSerialBatch', mesSerialBatch)
  app.use(store)
  return {
    app
  }
}
